diff options
| author | HATEC\SPVDEV001 <tri.susilo@altama.co.id> | 2023-09-02 10:37:04 +0700 |
|---|---|---|
| committer | HATEC\SPVDEV001 <tri.susilo@altama.co.id> | 2023-09-02 10:37:04 +0700 |
| commit | 09996e253209cd6d163fa1b9a6667485b80dfa82 (patch) | |
| tree | 78d33cc888b2433b5c0ac68fd0102de6c84a187a /src/pages/api/auth/[...nextauth].js | |
| parent | bca256dfc413400a6c17ca189a8f31a15d82473a (diff) | |
| parent | 6b1083de2c5ad57953c6653d00a42b2da3fea108 (diff) | |
Merge branch 'master' into CR/tampilan
Diffstat (limited to 'src/pages/api/auth/[...nextauth].js')
| -rw-r--r-- | src/pages/api/auth/[...nextauth].js | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/pages/api/auth/[...nextauth].js b/src/pages/api/auth/[...nextauth].js new file mode 100644 index 00000000..3c433167 --- /dev/null +++ b/src/pages/api/auth/[...nextauth].js @@ -0,0 +1,26 @@ +import odooApi from '@/core/api/odooApi' +import NextAuth from 'next-auth/next' +import GoogleProvider from 'next-auth/providers/google' + +export default NextAuth({ + providers: [ + GoogleProvider({ + clientId: process.env.GOOGLE_CLIENT_ID, + clientSecret: process.env.GOOGLE_CLIENT_SECRET + }) + ], + callbacks: { + async jwt({ token, account }) { + if (account) { + token.accessToken = account.access_token + } + return token + }, + async session({ session, token, user }) { + session.accessToken = token.accessToken + + return session + } + }, + secret: process.env.JWT_SECRET +}) |
